from .heap import MaxHeap


class PriorityQueue:
    """使用最大堆实现优先队列"""
    def __init__(self):
        self._heap = MaxHeap()

    def size(self):
        return self._heap.size()

    def __len__(self):
        return len(self._heap)

    def is_empty(self):
        return self._heap.is_empty()

    def get_front(self):
        return self._heap.find_max()

    def enqueue(self, e):
        self._heap.add(e)

    def dequeue(self):
        return self._heap.extract_max()
